package com.example.controller;



import com.example.entity.Student;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.ArrayList;
import java.util.List;

@Controller
public class IndexController {

    @GetMapping("/index")
    public String index(Model model){
        model.addAttribute("hello","传递的内容");

        Student student = new Student();
        student.setId(1);
        student.setName("zhangsan");
        student.setSex(0);
        List<String> hobby = new ArrayList<>();
        hobby.add("sleep");
        hobby.add("basketball");
        student.setHobby(hobby);
        model.addAttribute("student",student);
        return "index";
    }


}

